home *** CD-ROM | disk | FTP | other *** search
-
- 00010 *"D:RAMXE.ASM
- 00020 .LI OFF
- 00030 *--------------------------------
- 00040 * Copyright 1985 by Daniel L. Moore
- 00050 * This program may not be sold,
- 00060 * but it may be freely copied and
- 00070 * distributed.
- 00080 *--------------------------------
- 00090 * Last modified 04/16/85
- 00100 *--------------------------------
- 00110 * Allow usage of extra RAM in
- 00120 * 130XE computers from BASIC.
- 00130 * There are 2 USR routines:
- 00140 * The first routine checks if
- 00150 * the machine is a 130XE;
- 00160 * The second moves blocks of
- 00170 * memory to and from the additional
- 00180 * 64K of banked RAM in the 130XE.
- 00190 *--------------------------------
- 00200 * Hardware Equates
- 00210 *
- 00220 PORTB .EQ $D301
- 00230 *
- 00240 * Page 0 RAM for pointers
- 00250 *
- 00260 SOURCE .EQ $D4 FP register 0
- 00270 SOURCE.BNK .EQ $D6
- 00280 DEST .EQ $D8
- 00290 DEST.BNK .EQ $DA
- 00300 LENGTH .EQ $DC
- 00310 *--------------------------------
- 00320 * Place the code on Page 6, where
- 00330 * BASIC won't overwrite it.
- 00340 *
- 00350 .OR $600
- 00360 *
- 00370 .TF "D:RAMXE.OBJ
- 00380 *--------------------------------
- 00390 * In both routines, the value
- 00400 * returned indicates success or
- 00410 * failure of the requested function.
- 00420 * If the USR routine was successfull,
- 00430 * a 0 will be returned. Otherwise
- 00440 * the result will be non-zero.
- 00450 *--------------------------------
- 00460 * This routine is callable from
- 00470 * BASIC. Use the statement:
- 00480 * A=USR(1536)
- 00490 * to check if the machine is a
- 00500 * 130XE. A 0 result means a 130XE
- 00510 * any other value is not a 130XE.
- 00520 *
- 00530 CHECK.XE
- 00540 PLA parameter count from BASIC
- 00550 BNE BAD.PARAMETERS
- 00560 * Check if banked RAM is present
- 00570 LDX $4000
- 00580 LDA XE.BANKS+1
- 00590 STA PORTB bank #1
- 00600 DEX
- 00610 STX $4000
- 00620 LDA XE.BANKS
- 00630 STA PORTB normal RAM
- 00640 CPX $4000
- 00650 BNE GOOD.EXIT
- 00660 BEQ EXIT.1
- 00670 *--------------------------------
- 00680 * Incorrect number of parameters
- 00690 * passed to the routine, clean up
- 00700 * the stack and then exit.
- 00710 BAD.PARAMETERS
- 00720 TAY
- 00730 BEQ .2
- 00740 .1 PLA drop 2 bytes
- 00750 PLA
- 00760 DEY
- 00770 BNE .1 done?
- 00780 .2 LDA #$FF
- 00790 BNE EXIT.1
- 00800 *--------------------------------
- 00810 * The following routine moves
- 00820 * blocks of memory to and from the
- 00830 * the banked RAM in the 130XE.
- 00840 *
- 00850 * To call this routine from BASIC:
- 00860 * A=USR(1577,<source address>,<source bank>,
- 00870 * <dest address>,<dest bank>,<length)
- 00880 *
- 00890 * The 130XE banks the middle 16K
- 00900 * of RAM. There are actually 5
- 00910 * banks available, numbered 0 to
- 00920 * 4. Bank 0 is the "normal" RAM
- 00930 * that is present when the 130XE
- 00940 * is turned on. Banks 1 to 4 are
- 00950 * the additional 64K of memory
- 00960 * that is present in the machine.
- 00970 * Each bank is 16K (16384) bytes
- 00980 * long.
- 00990 *
- 01000 * Upon entry, the top of stack is
- 01010 * the number of parameters, the
- 01020 * next byte is the HIGH part
- 01030 * of the parameter, the next byte
- 01040 * is the LOW byte of parameter.
- 01050 * NOTE: This routine assumes the
- 01060 * source and destination blocks
- 01070 * do not overlap. If they do, then
- 01080 * all bytes from the start of the
- 01090 * overlap to the end will be set
- 01100 * to the same value.
- 01110 *
- 01120 MOVEBLOCK
- 01130 PLA parameter count
- 01140 CMP #5 5 parameters?
- 01150 BNE BAD.PARAMETERS
- 01160 * Get 10 bytes from the stack.
- 01170 LDY #0
- 01180 .0 PLA get high byte
- 01190 STA SOURCE+1,Y
- 01200 PLA get low byte
- 01210 STA SOURCE,Y
- 01220 INY
- 01230 INY
- 01240 CPY #10
- 01250 BNE .0
- 01260 * Get the values for PORTB for
- 01270 * the banks.
- 01280 LDA #$FF
- 01290 LDY SOURCE.BNK
- 01300 CPY #5
- 01310 BGE EXIT.1
- 01320 LDA XE.BANKS,Y
- 01330 STA SOURCE.BNK
- 01340 LDY DEST.BNK
- 01350 CPY #5
- 01360 BGE EXIT.1
- 01370 LDA XE.BANKS,Y
- 01380 STA DEST.BNK
- 01390 *
- 01400 LDY #0
- 01410 * Check for partial page move
- 01420 LDA LENGTH+1
- 01430 BEQ .2
- 01440 * Move LENGTH+1 full pages
- 01450 .1 LDX SOURCE.BNK
- 01460 STX PORTB
- 01470 LDA (SOURCE),Y
- 01480 LDX DEST.BNK
- 01490 STX PORTB
- 01500 STA (DEST),Y
- 01510 INY
- 01520 BNE .1
- 01530 INC SOURCE+1
- 01540 INC DEST+1
- 01550 DEC LENGTH+1
- 01560 BNE .1
- 01570 * Move the last partial page
- 01580 .2 LDA LENGTH
- 01590 BEQ GOOD.EXIT
- 01600 .21 LDX SOURCE.BNK
- 01610 STX PORTB
- 01620 LDA (SOURCE),Y
- 01630 LDX DEST.BNK
- 01640 STX PORTB
- 01650 STA (DEST),Y
- 01660 INY
- 01670 DEC LENGTH
- 01680 BNE .21
- 01690 * Done, restore OS, and exit
- 01700 GOOD.EXIT
- 01710 LDA #0
- 01720 EXIT.1 STA SOURCE
- 01730 STA SOURCE+1
- 01740 * Reset to normal RAM
- 01750 LDX XE.BANKS
- 01760 STX PORTB
- 01770 RTS
- 01780 *--------------------------------
- 01790 * XE.BANKS is a table of values
- 01800 * that PORTB should be set to for
- 01810 * each bank. VBE is not cleared,
- 01820 * so all ANTIC functions will
- 01830 * continue to work from the
- 01840 * main 64K, not the extra 64K.
- 01850 *
- 01860 XE.BANKS .HS FDE1E5E9ED
- 01870 *--------------------------------
- 01880 *
- 01890 END .EN
- 01900 *
-
-
-